#ifndef Mario_h
#define Mario_h

#include <d3d9.h>
#include <d3dx9.h>
#include"AnimatedSprite.h"
#include "Keyboard.h"
#include "Texture.h"
#include "MovableObject.h"
#include "ViewPort.h"

#include <vector>
using namespace std;

#define SPEED 1.2 //speed max
#define SPEED_UNITS_ACC 0.000009f //value
#define STOP_ANIMATE_AT_SPEED 0.1f// Stop animating when speed = ?
#define ANIMATE_RATE 21 //ANIMATE_RATE <, Mario animates slowlier
#define MARIO_WIDTH 60
#define MARIO_HEIGHT 85
#define SPEED_UNITS_DES 0.00001f
class Mario : public MovableObject
{
	Texture _texture;

	//for init mario's position
	static D3DXVECTOR2 _tempPosition;
	
	//last vx of player before stop (to determine the direction of mario)
	float _vx_last;  
	Sprite * _jumpSprite; 

	// True if the jump key is currently held down (key must be released to allow a new jump)
	bool jumpKeyDown;
public:
	//bool jumping;
	Mario();
	~Mario();
		// True if currently jumping (prevents the player jumping while in mid-air)

	D3DXVECTOR2 GetPosition();
	static void SetPosition(D3DXVECTOR2 position);
	void LoadResources(LPD3DXSPRITE SpriteHandler);
	void Update(int Delta, vector<GameObject*> vectorObj, QRectangle bound);
	void RenderFrame(LPDIRECT3DSURFACE9 BackBuffer, ViewPort *viewport);
	
	void Left();
	void Right();
	void Jump();
	void Reset();
	
	float GetLowY();
	float GetLeft();
	int GetWidth();
	int GetHeight();
};
#endif